import React from 'react';
import './App.css';

/* 引入路由信息 */
import routerConfig from './router/router';
/* 引入路由表 */
import RouterView from './router/RouterView';
/* 引入类型文件 */
import { IRouterItem } from './utils/interface';

/* 引入上下文 */
import useStore from './context/useStore';

/* 引入国际化配置 */
import { IntlProvider } from 'react-intl';

import {useObserver} from 'mobx-react-lite';

/* 引入中英文配置 */
import zhCN from './lang/zh-CN';
import enUS from './lang/en-US';

const localeMap = {
	en: enUS,
	zh: zhCN
}

function App() {
  const {lang} = useStore()
  return useObserver(()=><div className="app">
      {/* 国际化配置 */}
		<IntlProvider locale={lang.local} messages={localeMap[lang.local as 'en' | 'zh']}>
      <RouterView routes={routerConfig.routes as IRouterItem[]}></RouterView>;
      </IntlProvider>
    </div>
  )
}

export default App;

